package com.gjzt.business.task.controller;

import net.sf.json.JSONObject;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.eastdigit.servlet.RequestAttribute;
import com.eastdigit.servlet.Response;
import com.eastdigit.servlet.ReqBean;
import com.gjzt.business.task.service.CheckTemplateService;

@Controller
@RequestMapping(value = "/template")
public class CheckTemplateController {

    @Autowired
    private CheckTemplateService checkTemplateService;

    /**
     * 查询
     *
     * @param reqBean
     * @return
     */
    @RequestMapping(value = "/query")
    @ResponseBody
    public JSONObject queryCheckTemplate(final @RequestAttribute(ReqBean.NAME) ReqBean reqBean) {
        return Response.response(checkTemplateService.findCheckTemplate(reqBean));
    }

    /**
     * 添加
     *
     * @param reqBean
     * @return
     */
    @RequestMapping(value = "/add")
    @ResponseBody
    public JSONObject addCheckTemplate(final @RequestAttribute(ReqBean.NAME) ReqBean reqBean) {
        checkTemplateService.addCheckTemplate(reqBean);
        return Response.responseSuccess();
    }

    /**
     * 修改
     *
     * @param reqBean
     * @return
     */
    @RequestMapping(value = "/update")
    @ResponseBody
    public JSONObject updateCheckTemplate(final @RequestAttribute(ReqBean.NAME) ReqBean reqBean) {
        checkTemplateService.updateCheckTemplate(reqBean);
        return Response.responseSuccess();
    }

    /**
     * 删除
     *
     * @param reqBean
     * @return
     */
    @RequestMapping(value = "/delete")
    @ResponseBody
    public JSONObject removeCheckTemplate(final @RequestAttribute(ReqBean.NAME) ReqBean reqBean) {
        checkTemplateService.removeCheckTemplate(reqBean);
        return Response.responseSuccess();
    }

    //TODO 其他功能
}